//
//  DetinationAreaCell.m
//  TravelToHelp
//
//  Created by lanou3g on 15/11/3.
//  Copyright © 2015年 冯贵宾. All rights reserved.
//

#import "DetinationAreaCell.h"

@implementation DetinationAreaCell

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        self.photoView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
        self.photoView.backgroundColor = [UIColor whiteColor];
        
        self.photoView.layer.cornerRadius = 8;
        self.photoView.layer.masksToBounds = YES;
        
        for (int i = self.photoView.height - 80; i < self.photoView.height - 50; i ++) {  // 50虚化的高度与颜色深浅
            CGFloat num = 1.0 / 30 *(30 - i);
            UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, self.photoView.height - i, self.photoView.width, 1)];   // _coverImageView背景图片
            view.backgroundColor = [UIColor colorWithRed:0 / 255.0 green:0 / 255.0 blue:0 / 255.0  alpha:num];
            [self.photoView addSubview:view];
        }
        
        
        self.lable = [[UILabel alloc] initWithFrame:CGRectMake(0, self.photoView.height - 80 , self.photoView.width, 30)];
        self.lable.textAlignment = NSTextAlignmentCenter;
        // lable.backgroundColor = [UIColor redColor];
        self.lable.font = [UIFont systemFontOfSize:28];
        
        self.lable.textColor = [UIColor whiteColor];
        [self.photoView addSubview:self.lable];
        [self addSubview:self.photoView];
    }
    return self;
}

- (void)setModel:(DestinationAreaModel *)model
{
    self.photoView.image = [UIImage imageNamed:model.imageName];
    self.lable.text = model.title;
}

@end
